Image processing device and machine tool

ABSTRACT

An image processing device includes: an imaging execution unit that captures a first partial image including a part of a tool by a camera, a position specifying unit that specifies a next imaging position on the basis of a partial shape of the tool included in the first partial image, and a position control unit that changes the relative positions of the tool and the camera to the specified imaging position. The imaging execution unit captures a second partial image including a part of the tool at the next imaging position.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of InternationalApplication No. PCT/JP2021/041336, filed on Nov. 10, 2021, which claimspriority to and the benefit of Japanese Patent Application No.2020-187758, filed on Nov. 11, 2020. The contents of these applicationsare incorporated herein by reference in their entirety.

BACKGROUND OF INVENTION 1. Field

The present invention relates to a technology for managing tool shapesin machine tools.

2. Description of Related Art

Examples of machine tools include devices for cutting a workpiece into adesired shape, and devices for depositing metal powder or the like tomake a workpiece. Examples of machine tools for cutting include aturning center that machines a workpiece by applying a cutting tool tothe workpiece that is being turned, a machining center that machines aworkpiece by applying a turning tool to the workpiece, and a combinedmachine including these functions in combination.

The tool is fixed to a tool holding unit such as a spindle or a toolrest. The machine tool processes a workpiece while moving the tool restand the like and selecting the tool to machine the workpiece accordingto a processing program prepared in advance.

When a tool rest or the like is moved three-dimensionally in a narrowmachining chamber, it must be controlled so that the tool does not comeinto contact with the workpiece itself, tailstock supporting theworkpiece, steady rest, and other equipment. Because tools vary in shapeand size, contact with one tool might occur at a position where contactdoes not occur with another tool. For this reason, when registering atool in a machine tool, the tool ID must be associated with the toolshape (e.g., see PTL 1).

RELATED ART LIST

PTL 1: JP 2016-218550 A

In general, tool shape data is downloaded from a website of the toolmanufacturer and input to a machine tool to register tool IDs and toolshapes in association with each other. However, such a registrationmethod is burdensome in terms of the workload and the burden of checkingto prevent input errors.

SUMMARY

An image processing device according to one aspect of the presentinvention includes: an imaging execution unit that captures a firstpartial image including a part of the tool by a camera; a positionspecifying unit that specifies a next imaging position on the basis of apartial shape of the tool included in the first partial image; and aposition control unit that changes the relative positions of the tooland the camera to the specified imaging position.

The imaging execution unit captures a second partial image including apart of the tool at the next imaging position.

An image processing device according to another aspect of the presentinvention includes: receiving unit that receives (1) a first partialimage including a part of a tool captured by a camera, and (2) a secondpartial image including a part of the tool captured by specifying thenext imaging position and changing the relative positions of the tooland the camera to the specified imaging position on the basis of apartial shape of the tool included in the first partial image; and animage processing unit that extracts first contour data of a part of thetool from the first partial image and second contour data of a part ofthe tool from the second partial image, to generate tool shape data ofthe tool on the basis of the first and second contour data.

A machine tool according to a certain aspect of the present inventionincludes: a camera; a tool holding unit to which a tool is attachable; amachining control unit that machines a workpiece with a tool accordingto a machining program; an imaging execution unit that captures a firstpartial image including a part of the tool by the camera; a positionspecifying unit that specifies a next imaging position on the basis of apartial shape of the tool included in the first partial image; and aposition control unit that changes the relative positions of the tooland the camera to the next imaging position.

The imaging execution unit captures a second partial image including apart of the tool at the next imaging position.

The present invention facilitates efficient image recognition of a toolshape.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is an external view of a machine tool;

FIG. 2 is a schematic diagram illustrating a positional relation among atool, a camera, and lighting device in a tool recognition area;

FIG. 3 illustrates a hardware configuration of a machine tool and animage processing device;

FIG. 4 is a functional block diagram of an image processing device;

FIG. 5 is a schematic diagram illustrating a positional relation betweena tool and an imaging area;

FIG. 6 is a schematic diagram illustrating a relation between a tool anda partial image;

FIG. 7 is a flowchart illustrating tool registration processing;

FIG. 8 is a flowchart illustrating shape recognition processing in S12of FIG. 7 ;

FIG. 9 illustrates a partial image when outer shape recognitionprocessing is performed;

FIG. 10 illustrates a first edge-point image;

FIG. 11 illustrates a partial image when performing direction specifyingprocessing;

FIG. 12 is a diagram illustrating the second edge-point image;

FIG. 13 illustrates tool shape data for a tool;

FIG. 14 is a schematic view illustrating a partial image at the time oftool tip detection in Modification 1;

FIG. 15 is a schematic view illustrating a partial image after toolmovement in Modification 1;

FIG. 16 is a first schematic diagram illustrating a position controlmethod when a second edge-point is detected in the third area inModification 2;

FIG. 17 is a second schematic diagram illustrating a position controlmethod when a second edge-point is detected in the third area inModification 2;

FIG. 18 is a first schematic diagram illustrating a position controlmethod when a second edge-point is detected in the sixth area inModification 2; and

FIG. 19 is a second schematic diagram illustrating a position controlmethod when a second edge-point is detected in the sixth area inModification 2.

DETAILED DESCRIPTION

FIG. 1 is an external view of a machine tool 100.

The machine tool 100 in this embodiment is a multitasking machine formachining a workpiece placed in a machining area 200. The workpiece isfixed to a holding unit 104 and cut by a tool 102 attached to a spindle,which is another holding unit. The holding unit 104 holding theworkpiece is rotationally driven by a driving mechanism.

When the tool 102 is inserted into a tool recognition area 210, alighting device 108 provided at a lower position illuminates the tool102 and a camera 106 provided at an upper position captures an image ofthe tool 102. On the basis of the result of this image capturing, toolshape recognition, described later, is performed. The configuration ofthe tool recognition area 210 will be further described with referenceto FIG. 2 below.

The machine tool 100 is provided with a cover 202 that shuts off theoutside. The cover 202 includes a door 204. A user opens the door 204 toinstall a workpiece in the machining area 200 and to remove theworkpiece from the machining area 200. An operation panel 206 acceptsvarious operations on the machine tool 100 from the user.

The operation panel 206 is connected to an image processing device 110.In this embodiment, the main part of the machine tool 100 and the imageprocessing device 110 are connected via a wiring cable. The imageprocessing device 110 may be incorporated into the machine tool 100,e.g., as an internal device of the operation panel 206.

A tool storage unit 130 stores a plurality of tools 102. A tool 102 isselected from a plurality of tools 102 stored in the tool storage unit130 by a tool changer (described later) and attached to the spindle. Asshown in FIG. 1 , the X- and Y-axes are defined in the horizontaldirection and the Z-axis is defined in the vertical direction. TheY-axis direction corresponds to the axial direction of the spindle andworkpiece.

FIG. 2 is a schematic diagram illustrating a positional relation amongthe tool 102, the camera 106, and the lighting device 108 in the toolrecognition area 210.

The tool 102 includes a blade part 112 used for machining the workpieceand a shank part 114 which is a part to be fixed to a holder 118 of aspindle 116. The spindle 116 is configured to be rotatable and movablewhile holding the tool 102. The spindle 116, which is also a holdingunit, can also rotate the holding tool.

The camera 106 is equipped with an image sensor (image pickup element)such as complementary metal oxide semiconductor (CMOS) or charge-coupleddevice (CCD). The camera 106 images the tool 102 attached to the spindle116 from above (in the Z-axis direction). The camera 106 is fixed in thetool recognition area 210. The tool 102 can be imaged from multipledirections by rotating the tool 102 about the Y-axis with the spindle116. In addition, multiple locations of the tool 102 can be imaged bymoving the tool 102 in the horizontal direction (XY direction) with thespindle 116.

The lighting device 108 is fixed at a lower position to face the camera106. The lighting device 108 illuminates the tool 102 from below.Transmitted illumination by the lighting device 108 enables the camera106 to obtain high-contrast captured images that make it easy to graspthe contour position of the tool 102.

When the user newly registers a tool 102, the user sets the toolregistration mode in the operation panel 206 and attaches the tool 102to the spindle 116. Next, the user inputs a desired tool ID. The spindle116 moves and rotates the tool 102, and the fixed camera 106automatically images the tool 102 from various positions and directions.From a number of captured images obtained by the camera 106, the toolshape is recognized and the tool ID and the tool shape are registered inassociation with each other. With such a control method, the tool shapecan be automatically registered. Details of how to recognize tool shapeswill be described later.

The camera 106 in this embodiment has a resolution of about one millionpixels (1224×1024). The imaging range is about 300 millimeters × 300millimeters. The camera 106 can capture up to 80 images per second.

FIG. 3 illustrates a hardware configuration of the machine tool 100 andthe image processing device 110.

The machine tool 100 includes an operation control device 120, amachining control unit 122, a machining device 124, a tool changing unit126, and the tool storage unit 130. The machining control unit 122,which functions as a numerical controller, transmits a control signal tothe machining device 124 according to a machining program. The machiningdevice 124 machines the workpiece by moving the spindle 116 according toinstructions from the machining control unit 122.

The operation control device 120 includes the operation panel 206 andcontrols the machining control unit 122. The tool storage unit 130stores tools. The tool changing unit 126 corresponds to the so-calledautomatic tool changer (ATC). The tool changing unit 126 takes out atool from the tool storage unit 130 according to the change instructionfrom the machining control unit 122, and exchanges the tool in thespindle 116 with the tool taken out.

The image processing device 110 mainly performs image processing such astool shape recognition. As described above, the image processing device110 may be configured as a part of the operation control device 120.

FIG. 4 is a functional block diagram of the image processing device 110.

Each component of the image processing device 110 is implemented byhardware including computing units such as central processing units(CPUs) and various computer processors, a storage device such asmemories and storages, and wired or wireless communication lines thatconnects these units and devices, and software that is stored in thestorage devices and supplies processing instructions to the computingunits. Computer programs may be constituted by device drivers, operatingsystems, various application programs on upper layers thereof, and alibrary that provides common functions to these programs. Each of theblocks described below represents a functional block, not a hardwareblock.

It should be noted that the operation control device 120 and themachining control unit 122 may also be implemented in a form in whichhardware including a computing unit such as a processor, storage unitssuch as memory and storage, and wired or wireless communication linesconnecting them, and software or programs stored in the storage units tosupply processing instructions to the computing units on an operatingsystem independent from the image processing device 110.

The image processing device 110 includes a user interface processingunit 140, a data processing unit 142, and a data storage unit 144.

The user interface processing unit 140 is responsible for processingrelated to the user interface, such as image display and audio output,in addition to accepting operations from the user. The data processingunit 142 performs various processes on the basis of the data acquired bythe user interface processing unit 140 and the data stored in the datastorage unit 144. The data processing unit 142 also functions as aninterface for the user interface processing unit 140 and the datastorage unit 144. The data storage unit 144 stores various programs andsetting data.

The user interface processing unit 140 includes an input unit 146 and anoutput unit 148.

The input unit 146 accepts input from a user via a touch panel or ahardware device such as a handle. The output unit 148 provides variouskinds of information to the user via image display or audio output. Theinput unit 146 includes an ID accepting unit 150 that accepts input of atool ID.

The data processing unit 142 includes an imaging execution unit 152, aposition specifying unit 154, a position control unit 156, a shapereproduction unit 158, a first edge detection unit 160, a second edgedetection unit 162, an image conversion unit 164, a tool registrationunit 166, and a movable range adjusting unit 168.

The imaging execution unit 152 instructs the camera 106 to capture animage. The position specifying unit 154 calculates the moving directionof the spindle 116 by a method described later when imaging the tool102. The position control unit 156 moves the spindle 116 when the tool102 is imaged. The shape reproduction unit 158 generates “tool shapedata” that indicates the three-dimensional shape of the tool 102 on thebasis of the captured image. The first edge detection unit 160 detects“first edge-points” indicating a contour position of the tool 102. Thesecond edge detection unit 162 also detects “second edge-points”indicating a contour position of the tool 102. The image conversion unit164 changes the resolution of the captured image.

The tool registration unit 166 registers the tool ID and tool shape datain the data storage unit 144 in association with each other. The tool IDand tool shape data may be provided from the image processing device 110to the operation control device 120. The movable range adjusting unit168 is a so-called interference check module and specifies the movablerange of the spindle 116 (the range within which the spindle 116 canmove) on the basis of the type of machine tool 100, the shape of theworkpiece, and the tool shape data of the tool 102 in use. The positionat which the spindle 116 interferes with another object, such as aworkpiece, varies depending on the shape and size of the tool 102. Themovable range adjusting unit 168 specifies the movable range of thespindle 116 according to the tool in use, on the basis of the tool shapedata. The machine tool 100 moves the spindle 116 within the movablerange of the spindle 116.

FIG. 5 is a schematic diagram illustrating a positional relation betweenthe tool 102 and an imaging area 170.

The imaging area 170 is located just below the light-receiving surfaceof the camera 106. The camera 106 images an object within the imagingarea 170. The position control unit 156 inserts the tool 102 into theimaging area 170 by moving the spindle 116. Since the imaging area 170is smaller than the tool 102, it is not possible to image the entiretool 102 at one time.

Enlarging the lens of the camera 106 to enlarge the imaging area 170will increase the cost of the camera 106. In addition, installing alarge camera 106 occupying large space in the tool recognition area 210is undesirable since this will reduce the space of the machining area200. Therefore, in the present embodiment, a scheme is adopted in whichthe tool 102 is imaged by a relatively small camera 106 in multipletimes, and the shape of the entire tool 102 is recognized on the basisof the plurality of the images captured in multiple times.

Tool shape recognition processing (hereafter referred to as “shaperecognition processing”) will take longer time as the increase in thenumber of times of movement of the tool 102 and the number of imagescaptured by imaging. In order to make the shape recognition processingefficient, it is necessary to move the tool 102 efficiently so as not tocapture an image that is unnecessary for recognizing the tool shape,specifically, an image that does not show the outer shape of the tool102.

Hereafter, the captured image of a part of the tool 102 imaged by thecamera 106 will be referred to as a “partial image”.

FIG. 6 is a schematic diagram illustrating a relation between the tool102 and a partial image.

At the time of tool registration, the position control unit 156 movesthe tool 102 (the spindle 116) in the negative Y-axis direction, thatis, in the direction where the imaging area 170 goes away from the tipside of the tool 102, at a constant speed. The imaging execution unit152 constantly monitors the imaging area 170. The live view image in theimaging area 170 is transmitted from the camera 106 to the imageprocessing device 110. When the tip of the blade part 112 is detected inthe imaging area 170 (live view image), the imaging execution unit 152instructs the camera 106 to capture an image (partial image). Wheninstructed, the camera 106 captures the first partial image and fixes itto the memory. In FIG. 6 , a partial image P1 is captured first.

Then, the position control unit 156 further moves the tool 102 (thespindle 116) in the negative Y-axis direction. At this time, theposition control unit 156 slightly moves the spindle 116 in the negativeX-axis direction as well so that the contour of the tool 102 does notdeviate from the imaging area 170 (details will be described later).After the movement, the imaging execution unit 152 instructs the camera106 to capture a partial image, and the camera 106 stores the secondpartial image P2 in the memory. In this way, the position control unit156 moves the spindle 116 appropriately to the left and right (X-axisdirection) while gradually moving the spindle 116 in the negative Y-axisdirection.

The imaging execution unit 152 instructs the camera 106 to performimaging (capturing of a partial image) in accordance with the movementof the spindle 116 so that the partial images P1 to P8 are captured. Onthe basis of the plurality of partial images P1 to P8, the shapereproduction unit 158 generates the contour of the tool 102, i.e., thetool shape data of the tool 102. By appropriately moving the spindle116, the contour of the tool 102 can be appropriately image-recognizedwhile reducing the number of times of partial image capturing.

FIG. 7 is a flowchart illustrating tool registration processing.

Tool registration is performed after a user inputs a tool ID. When thetool 102 to be registered is attached to the spindle 116 and the userinputs the tool ID, the position control unit 156 sets the rotationangle (e.g., 0 degrees) of the spindle 116 (S10). Hereafter, therotation angle of the spindle 116 is referred to as “spindle rotationangle”. In this embodiment, by rotating the tool 102 by every 12degrees, shape recognition processing is performed for a total of 30(=360/12) angles.

After setting the spindle rotation angle, the position control unit 156moves the spindle 116 in the XY direction, and the imaging executionunit 152 performs shape recognition processing by capturing a pluralityof partial images (S12). Details of the shape recognition processingwill be described later with reference to FIG. 8 below. In the shaperecognition processing, the contour of the tool 102 is specified aspoint sequence data at the set spindle rotation angle. If there remainsan unset spindle rotation angle (S14: N), the process returns to S10 toset the next rotation angle (e.g., 12 degree). When shape recognitionprocessing is performed for all 30 spindle rotation angles (S14: Y), theshape reproduction unit 158 generates tool shape data indicating thethree-dimensional shape of the tool 102 from the point sequence dataobtained for the multiple spindle rotation angles (S16). The toolregistration unit 166 registers the tool ID and the tool shape data inthe data storage unit 144 in association with each other (S18).

FIG. 8 is a flowchart illustrating the shape recognition processing inS12 of FIG. 7 .

After setting the spindle rotation angle, the position control unit 156moves the spindle 116 in the negative Y-axis direction, and the imagingexecution unit 152 captures a partial image (S20). The first edgedetection unit 160 recognizes the outer shape position of the tool 102in the partial image by detecting the first edge-points indicating thecontour of the tool 102 from the partial image (described later inrelation to FIG. 9 ) (S22). Next, the position specifying unit 154specifies the next imaging position, in other words, the movingdirection of the spindle 116, on the basis of the partial image of thetool 102 (S24). The method of specifying the direction of movement willbe described later with reference to FIG. 11 .

When it is necessary to capture the next partial image (S26: N), theposition control unit 156 moves the tool 102 (the spindle 116) in themoving direction specified in S24 (S28). Image capturing is completedwhen the spindle 116 is moved in the negative Y-axis direction by apredetermined distance (S26: Y), and processing proceeds to S14 in FIG.7 .

As described above, the shape recognition processing includes theprocessing of S22 to image-recognize the contour of the tool 102(hereafter referred to as “outer shape recognition processing”) and theprocessing of S24 to determine the next moving direction of the tool 102(hereafter referred to as “direction specifying processing”). Next,outer shape recognition processing and direction specifying processingwill be described.

FIG. 9 illustrates a partial image 290 when external shape recognitionprocessing is performed. FIG. 10 illustrates a first edge-point image190.

The partial image 290 shows a silhouette of the tool 102 projected frombelow by the lighting device 108. The first edge detection unit 160 setsscanning lines 180 a in the positive X-axis direction, and detectspoints located at the boundary between a dark area 182 (silhouetteregion where the tool 102 exists) and a light area 184 (region where thetool 102 does not exist) as the first edge-points 192. The first edgedetection unit 160 detects a plurality of first edge-points 192 whileshifting the scanning lines 180 a at a constant pitch.

Similarly, the first edge detection unit 160 sets scanning lines 180 bin the negative Y-axis direction and detects the first edge-points 192located at the boundary between the dark area 182 and the light area184. The first edge detection unit 160 detects a plurality of firstedge-points 192 while shifting the scanning lines 180 b at a constantpitch.

Furthermore, the first edge detection unit 160 sets scanning lines 180 cin the positive Y-axis direction and detects the first edge-points 192located at the boundary between the dark area 182 and the light area184. The first edge detection unit 160 detects a plurality of firstedge-points 192 while shifting the scanning lines 180 c at a constantpitch.

In this way, by setting the scanning lines 180 a, 180 b, and 180 c inthe three directions, a plurality of first edge-points 192 are detected,and the first edge-point image 190 shown in FIG. 10 is acquired. Theplurality of first edge-points 192 included in the first edge-pointimage 190 provide point sequence data indicating the outer shape of thetool 102. In this embodiment, the processing time required for the outershape recognition processing per partial image is about 200 to 250milliseconds.

FIG. 11 illustrates a partial image 290 when performing the directionspecifying processing. FIG. 12 illustrates a second edge-point image260.

The image conversion unit 164 sets the resolution of the partial image290 to a low resolution of 1/8 in the direction specifying processing.The resolution is reduced in order to suppress the number of pixels tobe processed to reduce the load and speed up the direction specifyingprocessing. It is desirable for the shape recognition process to use ahigh-resolution partial image 290 to recognize the shape of the tool102; on the other hand, it is more appropriate for the directionspecifying processing to use a low-resolution partial image 290 becausethis processing is conducted only for specifying the next imagingposition.

A reference point 250 is set at a predetermined position in the partialimage 290. In this embodiment, the reference point 250 is set at thecenter of the partial image. An arbitrary reference line 252 passingthrough the reference point 250 is also set. The reference line 252 inthis embodiment is set in the first quadrant in the XY plane when thereference point 250 is taken as the origin.

The second edge detection unit 162 sets scanning lines 254 a in thepositive X-axis direction, and detects points located at the boundarybetween the dark area 182 and the light area 184 as second edge-points194. The second edge detection unit 162 detects a plurality of secondedge-points 194 while shifting the scanning lines 254 a at a constantpitch. Similarly, the second edge detection unit 162 sets scanning lines254 b in the negative X-axis direction and detects points located at theboundary between the dark area 182 and the light area 184 as the secondedge-points 194. The second edge detection unit 162 detects a pluralityof second edge-points 194 while shifting the scanning lines 254 b at aconstant pitch.

The second edge detection unit 162 sets scanning lines 254 c in thenegative Y-axis direction and detects a plurality of second edge-points194 in the same manner while shifting the scanning lines 254 c at aconstant pitch. The second edge detection unit 162 sets scanning lines254 d in the positive Y-axis direction and detects a plurality of secondedge-points 194 while shifting the scanning lines 254 d at a constantpitch.

In this way, by setting the scanning lines 254 a, 254 b, 254 c, and 254d in the four directions, a plurality of second edge-points 194 aredetected, and the second edge-point image 260 shown in FIG. 12 isacquired. The second edge-points 194 are fewer than the firstedge-points 192 since the resolution of the partial image is reduced.

Next, the position specifying unit 154 sets a verification line 262connecting the reference point 250 and a second edge-point 194. Theposition specifying unit 154 calculates the angle formed by theverification line 262 and the reference line 252 (hereafter referred toas “edge angle”), and specifies the second edge-point 194A with thesmallest edge angle as the “selected second edge-point”. In the secondedge-point image 260, the edge angle is minimum when the secondedge-point 194A is selected. The position specifying unit 154 determinesthe next imaging position on the basis of the verification line 262A atthis time.

As shown in FIG. 12 , the second edge-point 194A (selected secondedge-point) selected by the position specifying unit 154 on the basis ofthe edge angle is set on the far side from the tip of the tool 102, inother words, the root side of the tool 102 as viewed from the referencepoint 250 set in the second edge-point image 260. Then, the positionspecifying unit 154 determines the next imaging position so that thesecond edge-point 194A moves to the position of the lower half (tip sideof the tool 102) in the tool length direction (Y-axis direction in FIG.12 ) of the tool 102 (“upper” means root side of the tool 102 and“lower” means tip side of the tool 102). The position specifying unit154 also determines the next imaging position so that the secondedge-point 194A moves to the center side in the tool radial direction(X-axis direction in FIG. 12 ) of the tool 102. In FIG. 12 , since thesecond edge-point 194A (selected second edge-point) is located on thepositive Y-axis direction side (upper side) and the negative X-axisdirection side (left side) of the second edge-point image 260, theposition specifying unit 154 moves the tool 102 along a movement vector264 (negative Y-axis direction and positive X-axis direction) to changethe relative positions of the imaging area 170 and the tool 102 so thatthe second edge-point 194A (selected second edge-point) moves to thelower side and to the center side.

That is, the position specifying unit 154 moves the tool 102 (thespindle 116) along the verification line 262A in the direction indicatedby the movement vector 264 shown in FIG. 12 . At this time, the Ycomponent (insertion direction) of the movement vector 264 of the tool102 may be constant. That is, according to the magnitude of the minimumedge angle, the position control unit 156 adjusts the magnitude of the Xcomponent of the movement vector 264 for the tool 102. When the tool 102moves in the direction of the movement vector 264, the second edge-point194A (the point indicating the contour line) moves toward the center inthe next partial image 290. With such a control method, it is possibleto control so that the contour line of the tool 102 does not come off inthe imaging area 170, in other words, so as not to capture a partialimage that does not include the contour line. In the present embodiment,the processing time required for direction specifying processing perpartial image is about 10 to 20 milliseconds.

FIG. 13 illustrates the tool shape data of the tool 102.

The position control unit 156 sets the spindle rotation angle of thetool 102 about the Y-axis center, and then moves the tool 102 in theX-axis direction on the basis of the edge angle while also moving thetool 102 in the negative Y-axis direction. The outer shape of the tool102 is specified by capturing the partial image 290 in the imaging area170 and detecting the first edge-points 192 from the partial image 290.After detecting the first edge-points 192, the next imaging position isadjusted by detecting the second edge-points 194. A plurality of partialimages are captured per spindle rotation angle. Then, the positioncontrol unit 156 rotates the tool 102 by 12 degrees and performs thesame process for the next spindle rotation angle.

If ten partial images 290 are captured per one spindle rotation angle, atotal of 300 partial images 290 can be captured by 30 spindle rotationangle settings. The point sequence series data shown in the firstedge-point image 190 are obtained from these partial images 290. Theshape reproduction unit 158 synthesizes the point sequence data of eachpartial image 290 to generate the tool shape data shown in FIG. 13 ,i.e., the point sequence data indicating the three-dimensional shape ofthe tool 102.

Summary of Embodiment

The image processing device 110 and the machine tool 100 have beendescribed on the basis of the above described embodiment.

According to this embodiment, after a user attaches the tool 102 to thespindle 116 and inputs the tool ID, the tool shape data is automaticallygenerated, and the tool ID and the tool shape data are registered inassociation with each other. The number of tools 102 registered in thetool storage unit 130 may be several dozen. Therefore, automating theregistration of tool shape data has a great effect on improving the workefficiency of the machine tool 100.

In this embodiment, a small camera 106 is used to image only a part ofthe tool 102. The use of a small camera 106 reduces the cost of thecamera 106 and also contributes to the space saving of the machiningarea 200. By performing direction specifying processing on the secondedge-point image 260, the outer shape of the tool 102 can beappropriately recognized while reducing the number of times of capturingthe partial image 290. A partial image 290 not including the contour ofthe tool 102 is unnecessary for the shape recognition of the tool 102.The position specifying unit 154 adjusts the amount of movement of thecamera 106 in the X-axis direction on the basis of the edge angle sothat the partial image always captures the outer shape of the tool 102.

In addition, the resolution of the partial image used in the directionspecifying processing is set lower than that of the partial image usedin the shape recognition process to speed up the direction specifyingprocessing. Recognizing the outer shape of the tool 102 with ahigh-resolution partial image and specifying the moving direction of thetool 102 with a low-resolution partial image will improve both imagerecognition accuracy and processing speed.

The present invention is not limited to the embodiment described aboveand modifications thereof, and any component thereof can be modified andembodied without departing from the scope of the invention. Componentsdescribed in the embodiment and modifications can be combined asappropriate to form various embodiments. Some components may be omittedfrom the components presented in the embodiment and modifications.

Modifications

In the above description, the shape reproduction unit 158 generates toolshape data as point sequence data (see FIG. 13 ). However, the shapereproduction unit 158 may generate tool shape data as a polygon byapplying a texture to the point sequence data.

In the above embodiment, the camera 106 is fixed while moving the tool102 (the spindle 116). As a modification, the tool 102 (the spindle 116)may be fixed while moving the camera 106. Alternatively, both the camera106 and the tool 102 (the spindle 116) may be moved. In any case, apartial image may be captured while changing the relative positions ofthe camera 106 and the tool 102.

In the above embodiment, the shape recognition processing is followed bythe direction specifying processing. As a modification, the shaperecognition processing and the direction specifying processing may beexecuted in parallel.

In the above embodiment, the first edge-points 192 are detected for theouter shape recognition of the tool 102 and the second edge-points 194are detected for the directional control of the tool 102 (the spindle116). As a modification, the position specifying unit 154 may specifythe moving direction of the tool 102 by calculating the verificationline 262 and the edge angle on the basis of the first edge-points 192.

The image processing device 110 may include a receiving unit and animage processing unit. The receiving unit of the image processing device110 receives a first partial image including a part of the tool 102 fromthe camera 106. Similarly, the receiving unit receives a second partialimage including another part of the tool 102 from the camera 106. Thatis, the camera 106 or an image capturing device equipped with the camera106 may have the functions of the imaging execution unit 152, theposition specifying unit 154, the position control unit 156, the secondedge detection unit 162, and the image conversion unit 164. The imageprocessing unit of the image processing device 110 has the functions ofthe shape reproduction unit 158 and the first edge detection unit 160.

The image processing unit of the image processing device 110 receivesthe first partial image (e.g., partial image P1 in FIG. 6 ) and thesecond partial image (e.g., partial image P2 in FIG. 6 ) correspondingto the next imaging position with the camera 106 or the like. The sameapplies to the subsequent partial image (partial image P3). The imageprocessing unit extracts first contour data indicating the contour ofthe tool 102 from the first partial image and second contour dataindicating the contour of the tool 102 from the second partial image.The method for extracting the contour data is the same as the methoddescribed in relation to FIGS. 11 and 12 . Then, the image processingunit may reproduce the tool contour data of the tool 102 on the basis ofthe contour data (point group) obtained from a plurality of partialimages.

In the above embodiment, the tool 102 is imaged sequentially from thetip to the root after the spindle rotation angle is set to apredetermined angle, and the spindle rotation angle is changed after theimaging is completed. The present invention is not limited to this andthe tool 102 may be continuously imaged by the camera 106 while rotatingthe tool 102. For example, the camera 106 may capture images in multipleangles while rotating the camera 106 by synchronizing the rotationtiming of the spindle 116 with the imaging timing of the camera 106 sothat the camera 106 captures images of the tool 102 every t secondswhile rotating the tool 102 by a predetermined angle every t seconds.After one rotation of the camera 106 at a predetermined position, thecamera 106 may be moved horizontally in the XY direction and the camera106 may perform image capturing again from multiple angles at anotherposition.

The camera 106 may image the tool 102 at regular time intervals. At thistime, the camera 106 may send a synchronization signal to the imageprocessing device 110 in accordance with the imaging timing. The imageprocessing device 110 may control the timing of the movement or rotationof the tool 102 in accordance with this synchronization signal.

It is also possible that the imaging timing of the camera 106 and therotation timing of the spindle rotation angle do not perfectly match.The camera 106 may transmit a synchronization signal to the machiningcontrol unit 122 and the image processing device 110 at the imagingtiming, and the image processing device 110 may measure the rotationangle of the spindle 116 when the synchronization signal is received.For example, it is assumed that the tool 102 is imaged by the camera 106at a timing when the spindle rotation angle is set to 36 degrees.However, imaging might be performed when the rotation of the spindle 116is not fully completed, e.g., when the spindle rotation angle is 35.99degrees. Therefore, the machining control unit 122 may measure theactual spindle rotation angle at the imaging timing, and the imagingexecution unit 152 may store the partial image and the actual spindlerotation angle in association with each other. With such a controlmethod, the actual spindle rotation angle in the partial image (capturedimage) can be accurately recorded, which makes it easier to reproducetool contour data more accurately.

The image processing device 110 may perform: a step of capturing apartial image including a part of the tool 102 by the camera 106; a stepof specifying a next imaging position on the basis of the partial shapeof the tool 102 included in the partial image; a step of changing therelative positions of the tool 102 and the camera 106 to the specifiedimaging positions; and a step of capturing a partial image including apart of the tool 102 at the next imaging position.

The various computers exemplified by the image processing device 110 mayexecute a computer program that implement: a function of capturing apartial image including a part of the tool 102 by the camera 106; afunction of specifying the next imaging position on the basis of thepartial shape of the tool 102 included in the partial image; a functionof changing the relative positions of the tool 102 and the camera 106 tothe specified imaging positions; and a function of capturing a partialimage including a part of the tool 102 at the next imaging position.

FIG. 14 is a schematic view illustrating a partial image at the time oftool tip detection in Modification 1.

In the partial image 290 (imaging area 170), the position specifyingunit 154 specifies the tip of the tool 102 (hereafter referred to as“tool tip”). The center of the partial image 290 is the reference point250. With regard to the partial image 290 in FIG. 14 , the lower side ofthe drawing (the negative Y-axis side) is referred to as the “lowerside” and the upper side of the drawing (the positive Y-axis side) isreferred to as the “upper side”.

The extending direction of the tool 102 is referred to as the “toollength direction” and the radial direction (transverse direction) of thetool 102 is referred to as the “tool radial direction”. The line in theY-axis direction passing through the reference point 250 is called the“center line 292”. In the tool radial direction, the direction towardthe center line 292 is called the “center side” and the direction awayfrom the center line 292 is called the “end side”.

The partial image 290 is equally divided into four regions with thereference point 250 as the center, the upper right region is referred toas the first area C1, the upper left region is referred to as the secondarea C2, the lower left region is referred to as the third area C3, andthe lower right region is referred to as the fourth area C4.

By a method similar to that described in relation to FIGS. 11 and 12 ,the position specifying unit 154 specifies a plurality of secondedge-points 194. In Modification 1, the position specifying unit 154selects the second edge-points 194 farthest from the reference point250. In FIG. 14 , the second edge-points 194 farthest from the referencepoint 250 are a second edge-point 194B and a second edge-point 194C. Theposition specifying unit 154 selects a second edge-point 194 located onthe first area C1 or on the center line 292 from the second edge-point194B and the second edge-point 194C. In FIG. 14 , the second edge-point194B in the first area C1 is selected. The position control unit 156instructs the moving direction of the tool 102 to the machining controlunit 122 so that the selected second edge-point 194B (selected secondedge-point) overlaps with the reference point 250.

FIG. 15 is a schematic view illustrating a partial image after toolmovement in Modification 1.

By the movement of the tool 102, the second edge-point 194B coincideswith the reference point 250. The position control unit 156 againselects a second edge-point 194E farthest from the reference point 250.However, the second edge-point 194E does not satisfy the condition “onthe first area C1 or on the center line 292”. Then, the position controlunit 156 selects the second edge-point 194D which is next farthest ascompared with the second edge-point 194E. The second edge-point 194Dlies on the center line 292, thereby satisfying the above condition. Atthis time, the position control unit 156 instructs the moving directionto the machining control unit 122 so that the second edge-point 194D(selected second edge-point) overlaps with the reference point 250. InModification 1, a plurality of partial images 290 are acquired from thetool 102 by repeating such control.

FIG. 16 is a first schematic diagram illustrating a position controlmethod when a second edge-point is detected in the third area inModification 2.

In Modification 2, the partial image 290 is divided into six regionsfrom the first area D1 to the sixth area D6 as shown in FIG. 16 . Here,it is assumed that a second edge-point 194F (the farthest secondedge-point 194 from the reference point 250) is detected in the upperleft third area D3.

FIG. 17 is a second schematic diagram illustrating a position controlmethod when a second edge-point is detected in the third area inModification 2.

In Modification 2, the position control unit 156 instructs the movingdirection of the tool 102 to the machining control unit 122 so that thesecond edge-point 194F is included in the fifth area D5. As shown inFIG. 17 , when the second edge-point 194E is detected in the third areaD3, the tool 102 will move in both the Y direction (tool lengthdirection) and the X direction (tool radial direction).

FIG. 18 is a first schematic diagram illustrating a position controlmethod when a second edge-point is detected in the sixth area inModification .

Here, it is assumed that a second edge-point 194G (the farthest secondedge-points 194 from the reference point 250) is detected in the lowerright sixth area D6.

FIG. 19 is a second schematic diagram illustrating a position controlmethod when a second edge-point is detected in the sixth area inModification 2.

As in FIG. 16 and FIG. 17 , the position control unit 156 instructs themoving direction of the tool 102 to the machining control unit 122 sothat the second edge-point 194G is included in the fifth area D5. Asshown in FIG. 19 , when the second edge-point 194G is detected in thesixth area D6, the tool 102 will move in the X direction (tool radialdirection).

In this way, the position specifying unit 154 detects multiple secondedge-points 194 and selects a second edge-point 194 in the upper half(first area D1 to third area D3) of the partial image 290 (imaging area170). Although the second edge-point 194 farthest from the referencepoint 250 is selected in FIGS. 17 to 19 in the above example, any secondedge-point 194 in the upper half may be selected. The position controlunit 156 instructs the moving direction of the tool 102 to the machiningcontrol unit 122 so that the selected second edge-point 194 ispositioned in the middle region (the fifth area D5) in the lower halfthat is divided into three regions.

What is claimed is:
 1. An image processing device, comprising: a secondedge detection unit that detects a plurality of second edge-pointsindicating an outer shape position of a tool in a first partial imageincluding a part of the tool; a movement specifying unit that selects,from second edge-points of a part of the plurality of secondedge-points, a second edge-point on the far side from a tip of the toolas a selected second edge-point for specifying a next imaging positionto specify a moving direction of relative positions of a camera and thetool so that the selected second edge-point is located at the lower halfpositions in the tool length direction and at the center side in thetool diameter direction in the first partial image; and a positioncontrol unit that changes the relative positions of the tool and thecamera on the basis of the moving direction, wherein the imageprocessing device causes the camera to capture a second partial imageincluding the selected second edge-point and including a part of thetool at the next imaging position.
 2. An image processing device,comprising: a second edge detection unit that detects a plurality ofsecond edge-points indicating an outer shape position of a tool in afirst partial image including a part of the tool; a position specifyingunit that selects, from the plurality of second edge-points, a secondedge-point at which the relative angle between a given reference lineextending from a given reference point and a verification lineconnecting the reference point and the second edge-points is minimizedin the first partial image as the selected second edge-point to specifya moving direction of the relative positions of a camera and the tool inthe direction in which the selected second edge-point approaches thereference point; and a position control unit that changes the relativepositions of the tool and the camera on the basis of the movingdirection, and wherein the image processing device causes the camera tocapture a second partial image including the selected second edge-pointand including a part of the tool at the next imaging position.
 3. Theimage processing device according to claim 1, wherein a secondedge-point at which the relative angle between a given reference lineextending from a given reference point and a verification lineconnecting the reference point and the second edge-points is minimizedin the first partial image is selected as the selected second edge-pointto specify a moving direction of relative positions of the camera andthe tool in the direction in which the selected second edge-pointapproaches the reference point.
 4. The image processing device accordingto claim 1, wherein an imaging execution unit captures the first partialimage of the tool when the tip of the tool is detected in an imagingrange during moving the camera and the tool relative to each other. 5.The image processing device according to claim 1, wherein the positioncontrol unit further changes the relative angle between the tool and thecamera, and wherein the imaging execution unit captures partial imagesfor each of a plurality of relative angles.
 6. The image processingdevice according to claim 1, further comprising: a first edge detectionunit that detects a plurality of first edge-points indicating the outershape position of the tool in the first partial image; and a shapereproduction unit that forms tool shape data indicating the outer shapeof the tool on the basis of the plurality of first edge-points detectedfrom the first partial image.
 7. The image processing device accordingto claim 6, further comprising: an image conversion unit that convertsthe first partial image into a low-resolution image, wherein the secondedge detection unit detects second edge-points from the low-resolutionfirst partial image.
 8. The image processing device according to claim1, further comprising: an ID accepting unit that accepts input of a toolID that identifies a tool; a first edge detection unit that detects aplurality of first edge-points indicating the outer shape position ofthe tool in the first partial image; a shape reproduction unit thatforms tool shape data indicating the outer shape of the tool on thebasis of a plurality of first edge-points detected from a plurality offirst partial images; and a tool registration unit that registers a toolID and tool shape data in association with each other.
 9. A machinetool, comprising: a camera; a tool holding unit to which a tool isattachable; a machining control unit that machines a workpiece with atool according to a machining program; an imaging execution unit thatcaptures a first partial image including a part of the tool by thecamera; a position specifying unit that specifies a next imagingposition on the basis of a partial shape of the tool included in thefirst partial image; and a position control unit that changes therelative positions of the tool and the camera to the next imagingposition, wherein the imaging execution unit captures a second partialimage including a part of the tool at the next imaging position.